using System;
using System.Collections;
using System.Text;

namespace GeneralLibs
{
    public class NullableDate
    {
        private DateTime _Date;
        public bool IsNull = true;
        
        public DateTime Date
        {
            get
            {
                return _Date;
            }
        }
        public NullableDate()
        {
            _Date = DateTime.Now;
            IsNull = true;
        }
        public NullableDate(DateTime initDateTime)
        {
            _Date = initDateTime;
            IsNull = false;
        }
        public override string ToString()
        {
            if (IsNull) return "NULL";
            else return string.Format("'{0}'", _Date.ToString("yyyyMMdd HH:mm:ss:fff"));
        }
        public string ToVnFormat()
        {
            if (IsNull) return "NULL";
            else return string.Format("{0}/{1}/{2}", _Date.Day, _Date.Month, _Date.Year);
        }
        public string ToFulltimeVnFormat()
        {
            if (IsNull) return "NULL";
            else return string.Format("{0}/{1}/{2} {3}:{4}:{5}", 
                                    _Date.Day, _Date.Month, _Date.Year,
                                    _Date.Hour, _Date.Minute, _Date.Second);
        }
    }
}
